using Ardalis.Specification;

namespace Domain.Todos.Specifications;

/// <summary>
/// 包含用户信息的待办事项规约
/// 展示如何使用 Include
/// </summary>
public sealed class TodosWithUserSpecification : Specification<TodoItem>
{
    public TodosWithUserSpecification(Guid userId)
    {
        Query.Where(todo => todo.UserId == userId)
             .OrderByDescending(todo => todo.CreatedAt);
             // 如果有导航属性，可以这样使用：
             // .Include(todo => todo.User);
    }
}
